package core

import (
	"LearnProject/conf"
	"fmt"
	"io/ioutil"
	"gopkg.in/yaml.v2"
)

//获取mysql 的配置
func GetMysqlConfig() *conf.MysqlConfigStruct {
	config, err := ioutil.ReadFile("conf/mysql.yaml")
	if err != nil {
		fmt.Println("mysql config file miss!")
	}
	t := conf.CONFIG
	yaml.Unmarshal(config, &t)
	return t
}

//获取 redis 的配置
func GetRedisConfig() *conf.MysqlConfigStruct {
	config, err := ioutil.ReadFile("conf/redis.yaml")
	if err != nil {
		fmt.Println("redis config file miss!")
	}
	t := conf.CONFIG
	yaml.Unmarshal(config, &t)
	return t
}